'      BASIC Anywhere Machine test program for the PCOPY statement
'      Page 0 is always the active screen and always the one displayed
'      All commands to print text and to draw graphics work only on the
'      active screen
'      Pages 1 and 2 are the only other pages.
'
'      Syntax:  PCOPY (x1,y1) - (x2,y2), source_page, destination_page
'      Or, for full page copy:   PCOPY source_page, destination_page
'      ------------------------------------------------------------—       

CONST 📄active = 0, 📄background = 1, 📄msg = 2 

CONST screen_height = 228, screen_width = 5 * 228

' 🟠🟠🟠 Main Program

SCREEN _NEWIMAGE(screen_width, screen_height, 7)

GOSUB ➔SetupBackground
GOSUB ➔SetupMsg

➔IterationStart:
    GOSUB ➔DisplayBillboard
    GOSUB ➔PrepNextBillboard
GOTO ➔IterationStart

' 🟠🟠🟠 Subroutines

➔SetupBackground:

    FOR z = 0 TO 4
      c = 1
      FOR i = 0 TO 227 STEP 10
          LINE (228*z,i) - (i+228*z,0), c
          LINE (228*(z+1),i) - (i + 228*z,227), c
          c = c + 1 : IF c = 16 THEN c = 1
      NEXT i
    NEXT z
    PCOPY 📄active, 📄background
    CLS
    RETURN

➔SetupMsg:

    msg$ = "Howdy Doody ! "
    PRINT msg$
    FOR j = 0 TO 8
        LOCATE 10 + j, 1
            FOR k = 0 TO 8*LEN(msg$)
                IF POINT(k,j) = 0 THEN PRINT " "; ELSE PRINT "*";
            NEXT k
        PRINT
    NEXT j
    LOCATE 1,1 : PRINT SPACE$(70)
    PCOPY 📄active, 📄msg
    CLS
    RETURN
    
➔DisplayBillboard:

    PCOPY 📄background, 📄active
    PCOPY (0, 71) - (1139, 143), 📄msg, 📄active
    _DELAY 0.001
    RETURN
    
➔PrepNextBillboard:

    PCOPY 📄background, 📄active
    SCROLL +15,0,TRUE
    PCOPY 📄active, 📄background
    PCOPY 📄msg, 📄active
    SCROLL (0, 71) - (1139, 143), -5,0,TRUE
    PCOPY 📄active, 📄msg
    RETURN